(require 'cc-mode)

(defun c-mode-untabify ()
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward "[ \t]+$" nil t)
      (delete-region (match-beginning 0) (match-end 0)))
    (goto-char (point-min))
    (if (search-forward "\t" nil t)
        (untabify (1- (point)) (point-max))))
  nil)

(add-hook 'c-mode-hook 
          '(lambda ()
	     (setq-default indent-tabs-mode nil);
	     (c-set-style 'gnu)		
             (make-local-variable 'write-contents-hooks)
             (add-hook 'write-contents-hooks 'c-mode-untabify)))

